package com.powervision.sharesdkdemo.base;

import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;

import com.powervision.sharesdkdemo.app.MyApp;

/**
 * @auth: njb
 * @date: 2021/10/18 15:50
 * @desc: 描述
 */
public abstract class BaseActivity extends AppCompatActivity implements ViewHandlerCall {
    protected BasePresenter presenter;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(getLayoutId());
        MyApp app = new MyApp();
        app.setCurrentActivity(this);
        initData();
        initView();
        presenter = createPresenter();
        presenter.attachView(this);
    }

    //界面加载类
    public abstract int getLayoutId();

    //界面加载类
    public abstract void initView();

    //数据初始化完成操作
    public abstract void initData();

    @Override
    protected void onDestroy() {
        super.onDestroy();
        presenter.detailView();
    }

    //必须实现的中间处理类
    protected abstract BasePresenter createPresenter();
}
